<?php 

	include '../includes/conectionMySql.inc';
	$query = "SELECT chamado.solicitante, chamado.email, sistema.nome, chamado.horasConsumidas, ch_status.nome FROM chamados chamado inner join chamados_sistemas sistema ON chamado.sistema = sistema.id inner join chamados_status ch_status on chamado.status = ch_status.id WHERE chamado.id = ".$_GET['id'];
	$response = mysql_query($query);
	$row = mysql_fetch_array($response);
	$solicitante = $row[0];
	$email = $row[1];
	$sistema = $row[2];
	$horasConsumidas = $row[3];
	$status = $row[4];
	mysql_close($db);

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Lista de Chamados</title>
<link rel="stylesheet" type="text/css" media="screen" href="../css/vader/jquery-ui.css" />
<link rel="stylesheet" type="text/css" media="screen" href="../css/ui.jqgrid.css" />

<script src="../js/jquery-1.9.0.min.js" type="text/javascript"></script>
<script src="../js/jquery-ui-1.10.3.custom.js"></script>
<script src="../js/jquery.jqGrid.src.js" type="text/javascript"></script>
<script src="../js/i18n/grid.locale-pt-br.js" type="text/javascript"></script>

<script type="text/javascript">
	$(function(){
		jQuery('#list1').jqGrid({
			url:"listInteracoes.php?id=<?php echo $_GET['id']?>",
			datatype:'json',
			mtype: 'GET',
			colNames:['ID','Assunto','Data Interação','Visualizado'],
			colModel:[
				{name:'interacao.id',index:'interacao.id',width:40,formatter:'showlink',formatoptions:{
					baseLinkUrl:'formInfoInteracao.php',
				}},
				{name:'interacao.assunto',index:'interacao.assunto',width:150},
				{name:'interacao.dataInteracao',index:'interacao.dataInteracao',width:140},
				{name:'interacao.visualizado',index:'interacao.visualizado',width:80}				
			],
			rowNum:10,
			rowList:[10,20,30],
			pager: '#pager1',
			sortname:'id',
			viewrecords: true,
			sortorder:"asc",
			caption:"Lista de Interações chamado #<?php echo $_GET['id'];?>"
		});
		jQuery('#list1').jqGrid('navGrid','#pager1',{edit:false,add:false,del:false});
	});
</script>
</head>

<body>
	<h2>Lista de Interações referentes ao Chamado #<?php echo $_GET['id']?></h2>
    <table border="0">
    	<tr>
        	<td>Solicitante:</td>
            <td><?php echo $solicitante?></td>
        </tr>
        <tr>
        	<td>E-Mail:</td>
            <td><?php echo $email?></td>
        </tr>
        <tr>
        	<td>Sistema:</td>
            <td><?php echo $sistema?></td>
        </tr>
        <tr>
        	<td>Status:</td>
            <td><?php echo $status?></td>
        </tr>
        <tr>
        	<td>Horas Consumidas:</td>
            <td><?php echo $horasConsumidas?> Horas</td>
        </tr>
    </table>
	<table id="list1" name="list1"></table>
	<div id="pager1" name="pager1"></div>
    <table border="0">
    <tr><a href="formNovaInteracao.php?id=<?php echo $_GET['id']?>">Nova Interação</a></tr>
    </table>
</body>
</html>